<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>菜鸟教程 React 实例</title>
    <script src="https://cdn.staticfile.org/react/15.4.2/react.min.js"></script>
	<script src="https://cdn.staticfile.org/react/15.4.2/react-dom.min.js"></script>
	<script src="https://cdn.staticfile.org/babel-standalone/6.22.1/babel.min.js"></script>
  </head>
  <body>
	  <h1>使用 React.createClass 创建组件，在创建的同时声明类型要求</h1>
	  <div id="example"></div>
    <script type="text/babel">
     var title = "无间道2";
    // var title = 123;
    var MyTitle = React.createClass({
		propTypes:{
			title:React.PropTypes.number.isRequired
		},
		render: function(){
			return <h2>{this.props.title}</h2>
		}
		
	});
	
    ReactDOM.render(
        <MyTitle title={title} />,
        document.getElementById('example')
    );
    </script>
  </body>
</html>